﻿<Window x:Class="IS_Ever_Green.View.RegistrationView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:IS_Ever_Green.View"
        xmlns:viewModel="clr-namespace:IS_Ever_Green.ViewModel" 
        xmlns:customcontrols="clr-namespace:IS_Ever_Green.CustomControls"
        mc:Ignorable="d"
        Height="1024" Width="1440"
        WindowStyle="None"
        ResizeMode="NoResize"
        WindowStartupLocation="CenterScreen"
        MouseDown="Window_MouseDown"
        Background="Transparent"
        AllowsTransparency="True"
        >

    <Window.DataContext>
        <viewModel:RegistrationViewModel/>
    </Window.DataContext>

    <Border CornerRadius="16">
        
        <Border.Background>
            <ImageBrush ImageSource="/Images/background.png"/>
        </Border.Background>

        <Border CornerRadius="16"
            BorderThickness="5"
            >

            <Border.BorderBrush>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                    <GradientStop Color="{StaticResource winBorderColor1}" Offset="0.0"/>
                    <GradientStop Color="{StaticResource winBorderColor2}" Offset="0.5"/>
                    <GradientStop Color="{StaticResource winBorderColor3}" Offset="1.0"/>
                </LinearGradientBrush>
            </Border.BorderBrush>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="75"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="20"/>
                        <ColumnDefinition Width="40"/>
                        <ColumnDefinition Width="40"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Button x:Name="btnClose" 
                            BorderThickness="0"
                            Content="X"
                            Foreground="{StaticResource secondaryTextColor}"
                            FontSize="16"
                            FontFamily="Montserrat"
                            Cursor="Hand"
                            Grid.Column="1"
                            Click="btnClose_Click"
                            >   

                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Background" Value="{StaticResource primaryButtonColor}"/>
                                <Style.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Background" Value="{StaticResource primaryButtonHoverColor}"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>

                        <Button.Template>
                            <ControlTemplate TargetType="Button">
                                <Border Width="30" Height="30"
                                        CornerRadius="15"
                                        Background="{TemplateBinding Background}">

                                    <ContentPresenter VerticalAlignment="Center"
                                    HorizontalAlignment="Center"/>

                                </Border>
                            </ControlTemplate>
                        </Button.Template>

                    </Button>

                    <Button x:Name="btnMinimize" 
                            BorderThickness="0"
                            Content="-"
                            Foreground="{StaticResource secondaryTextColor}"
                            FontSize="25"
                            FontFamily="Montserrat"
                            Cursor="Hand"
                            Grid.Column="2"
                            Click="btnMinimize_Click"
                            >

                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Background" Value="{StaticResource secondaryButtonColor}"/>
                                <Style.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Background" Value="{StaticResource secondaryButtonHoverColor}"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>

                        <Button.Template>
                            <ControlTemplate TargetType="Button">
                                <Border Width="30" Height="30" 
                                        CornerRadius="15"
                                        Background="{TemplateBinding Background}">

                                    <ContentPresenter VerticalAlignment="Center"
                                    HorizontalAlignment="Center"/>

                                </Border>
                            </ControlTemplate>
                        </Button.Template>

                    </Button>

                </Grid>

                <Border Width="900"
                        Height="750"
                        Grid.Row="2"
                        Background="#fff"
                        CornerRadius="16"
                        >

                    <Border.Effect>
                        <DropShadowEffect ShadowDepth="5" Color="#000000" Opacity="0.2" BlurRadius="20"/>
                    </Border.Effect>

                    <StackPanel Orientation="Vertical"
                                Margin="20">
                        
                    
                        <Button x:Name="btnBack" 
                            BorderThickness="0"
                            Content="&lt;"
                            Foreground="{StaticResource secondaryTextColor}"
                            FontSize="25"
                            FontFamily="Montserrat"
                            Cursor="Hand"
                            Grid.Column="1"
                            HorizontalAlignment="Left"
                            Click="btnBack_Click"
                            >

                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Background" Value="{StaticResource secondaryButtonColor}"/>
                                <Style.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Background" Value="{StaticResource secondaryButtonHoverColor}"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>

                        <Button.Template>
                            <ControlTemplate TargetType="Button">
                                <Border Width="30" Height="30"
                                        CornerRadius="15"
                                        Background="{TemplateBinding Background}">

                                    <ContentPresenter VerticalAlignment="Center"
                                                      HorizontalAlignment="Center"/>

                                </Border>
                            </ControlTemplate>
                        </Button.Template>

                    </Button>
                    
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="80"/>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>


                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>

                            <Image Source="/Images/LogoName.png" Width="245" Height="80" HorizontalAlignment="Left" />

                            <TextBlock Text="Регистрация" 
                                       Foreground="{StaticResource primaryTextColor}"
                                       Grid.Column="1" 
                                       HorizontalAlignment="Center" 
                                       VerticalAlignment="Center"
                                       FontSize="25"
                                       FontFamily="Montserrat"
                                       />

                            <StackPanel
                                        Grid.Row="2"
                                        Orientation="Vertical"
                                        Margin="0 35 20 0"
                                        >

                                <TextBlock Text="Логин" 
                                           Foreground="{StaticResource primaryTextColor}"
                                           FontSize="20"
                                           FontWeight="Medium"
                                           FontFamily="Montserrat"
                                           Margin="0 40 0 0"
                                           />

                                <TextBox Text="{Binding Login, UpdateSourceTrigger = PropertyChanged}"
                                         Foreground="{StaticResource primaryTextColor}"
                                         FontSize="25"
                                         FontWeight="Medium"
                                         FontFamily="Montserrat"
                                         CaretBrush="{StaticResource markerColor}"
                                         BorderBrush="{StaticResource primaryTextColor}"
                                         BorderThickness="0 0 0 1"
                                         Height="35"
                                         VerticalContentAlignment="Center"
                                         Margin="0 5 0 0"
                                         Padding="30 0 0 0"
                                         >

                                    <TextBox.Background>
                                        <ImageBrush ImageSource="/Images/User/Login.png"
                                                    Stretch="none"
                                                    AlignmentX="Left"
                                                    />
                                    </TextBox.Background>
                                </TextBox>

                                <TextBlock  Text="{Binding ErrorMessageLogin}"
                                            Foreground="{StaticResource errorMessage}"
                                            FontSize="20"
                                            FontWeight="Medium"
                                            FontFamily="Montserrat"
                                            Margin="0 10 0 0"
                                            TextWrapping="Wrap"
                                            />

                                <TextBlock Text="Имя" 
                                           Foreground="{StaticResource primaryTextColor}"
                                           FontSize="20"
                                           FontWeight="Medium"
                                           FontFamily="Montserrat"
                                           Margin="0 20 0 0"
                                           />

                                <TextBox Text="{Binding FirstName, UpdateSourceTrigger = PropertyChanged}"
                                         Foreground="{StaticResource primaryTextColor}"
                                         FontSize="25"
                                         FontWeight="Medium"
                                         FontFamily="Montserrat"
                                         CaretBrush="{StaticResource markerColor}"
                                         BorderBrush="{StaticResource primaryTextColor}"
                                         BorderThickness="0 0 0 1"
                                         Height="35"
                                         VerticalContentAlignment="Center"
                                         Margin="0 5 0 0"
                                         Padding="30 0 0 0"
                                         >

                                    <TextBox.Background>
                                        <ImageBrush ImageSource="/Images/User/UserName_Surname.png"
                                                    Stretch="none"
                                                    AlignmentX="Left"
                                                    />    
                                    </TextBox.Background>
                                </TextBox>


                                <TextBlock Text="Фамилия"
                                           Foreground="{StaticResource primaryTextColor}"
                                           FontSize="20"
                                           FontWeight="Medium"
                                           FontFamily="Montserrat"
                                           Margin="0 60 0 0"
                                           />

                                <TextBox Text="{Binding LastName, UpdateSourceTrigger = PropertyChanged}"
                                         Foreground="{StaticResource primaryTextColor}"
                                         FontSize="25"
                                         FontWeight="Medium"
                                         FontFamily="Montserrat"
                                         CaretBrush="{StaticResource markerColor}"
                                         BorderBrush="{StaticResource primaryTextColor}"
                                         BorderThickness="0 0 0 1"
                                         Height="35"
                                         VerticalContentAlignment="Center"
                                         Margin="0 5 0 0"
                                         Padding="30 0 0 0"
                                         >  

                                    <TextBox.Background>
                                        <ImageBrush ImageSource="/Images/User/UserName_Surname.png"
                                                    Stretch="none"
                                                    AlignmentX="Left"
                                                    />      
                                    </TextBox.Background>
                                </TextBox>
                                
                            </StackPanel>

                            <StackPanel
                                        Grid.Row="2"
                                        Grid.Column="2"
                                        Orientation="Vertical"
                                        Margin="20 35 0 0"
                                        >


                                <TextBlock Text="Почта" 
                                           Foreground="{StaticResource primaryTextColor}"
                                           FontSize="20"
                                           FontWeight="Medium"
                                           FontFamily="Montserrat"
                                           Margin="0 40 0 0"
                                           />

                                <TextBox Text="{Binding Email, UpdateSourceTrigger = PropertyChanged}"
                                         Foreground="{StaticResource primaryTextColor}"
                                         FontSize="25"
                                         FontWeight="Medium"
                                         FontFamily="Montserrat"
                                         CaretBrush="{StaticResource markerColor}"
                                         BorderBrush="{StaticResource primaryTextColor}"
                                         BorderThickness="0 0 0 1"
                                         Height="35"
                                         VerticalContentAlignment="Center"
                                         Margin="0 5 0 0"
                                         Padding="30 0 0 0"
                                         >

                                    <TextBox.Background>
                                        <ImageBrush ImageSource="/Images/User/Email.png"
                                                    Stretch="none"
                                                    AlignmentX="Left"
                                                    />
                                    </TextBox.Background>
                                </TextBox>
                                
                                <TextBlock  Text="{Binding ErrorMessageEmail}"
                                            Foreground="{StaticResource errorMessage}"
                                            FontSize="20"
                                            FontWeight="Medium"
                                            FontFamily="Montserrat"
                                            Margin="0 10 0 0"
                                            TextWrapping="Wrap"
                                            />

                                <TextBlock Text="Пароль" 
                                           Foreground="{StaticResource primaryTextColor}"
                                           FontSize="20"
                                           FontWeight="Medium"
                                           FontFamily="Montserrat"
                                           Margin="0 20 0 0"
                                           />

                                <customcontrols:BindablePassword Password="{Binding Password, Mode=TwoWay ,UpdateSourceTrigger = PropertyChanged}"
                                                                 Height="35"
                                                                 Margin="0 5 0 0"
                                                                 >
                                </customcontrols:BindablePassword>


                                <TextBlock Text="Повторите пароль" 
                                           Foreground="{StaticResource primaryTextColor}"
                                           FontSize="20"
                                           FontWeight="Medium"
                                           FontFamily="Montserrat"
                                           Margin="0 60 0 0"
                                           />

                                <customcontrols:BindablePassword Password="{Binding PasswordRepeat, Mode=TwoWay ,UpdateSourceTrigger = PropertyChanged}"
                                                                 Height="35"
                                                                 Margin="0 5 0 0"
                                                                 >
                                </customcontrols:BindablePassword>
                                
                                <TextBlock  Text="{Binding ErrorMessagePassword}"
                                            Foreground="{StaticResource errorMessage}"
                                            FontSize="20"
                                            FontWeight="Medium"
                                            FontFamily="Montserrat"
                                            Margin="0 10 0 0"
                                            TextWrapping="Wrap"
                                            />

                            </StackPanel>
                        </Grid>

                        <Button Command="{Binding RegistrationCommand}"
                                BorderThickness="0"
                                Content="Зарегистрироваться"
                                Foreground="{StaticResource secondaryTextColor}"
                                FontSize="16"
                                FontFamily="Montserrat"
                                Cursor="Hand"
                                Grid.Column="1"
                                Margin="0 50 0 0"
                                >

                            <Button.Style>
                                <Style TargetType="Button">
                                    <Setter Property="Background" Value="{StaticResource primaryButtonColor}"/>
                                    <Style.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Background" Value="{StaticResource primaryButtonHoverColor}"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Button.Style>

                            <Button.Template>
                                <ControlTemplate TargetType="Button">
                                    <Border Width="400" Height="60"
                                            CornerRadius="16"
                                            Background="{TemplateBinding Background}">

                                        <ContentPresenter VerticalAlignment="Center"
                                                            HorizontalAlignment="Center"/>

                                    </Border>
                                </ControlTemplate>
                            </Button.Template>

                        </Button>

                        <StackPanel Orientation="Horizontal"
                                    HorizontalAlignment="Center"
                                    Margin="0 15 0 0"
                                    >

                            <TextBlock Text="Есть аккаунт?"
                                       Foreground="{StaticResource primaryTextColor}"
                                       FontSize="18"
                                       FontWeight="Medium"
                                       FontFamily="Montserrat"
                                       />

                            <Button Content="Войти"
                                    Foreground="{StaticResource primaryTextColor}"
                                    FontSize="18"
                                    FontWeight="Medium"
                                    FontFamily="Montserrat"
                                    Cursor="Hand"
                                    Margin="8 0 0 0"
                                    Click="Login_Click"
                                    >

                                <Button.Style>
                                    <Style TargetType="Button">
                                        <Setter Property="Background" Value="Transparent"/>
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Background" Value="Transparent"/>
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Button.Style>

                                <Button.Template>
                                    <ControlTemplate TargetType="Button">
                                        <Border CornerRadius="15"
                                                Background="{TemplateBinding Background}">

                                            <ContentPresenter VerticalAlignment="Center"
                                                              HorizontalAlignment="Center"/>

                                        </Border>
                                    </ControlTemplate>
                                </Button.Template>
                            </Button>

                        </StackPanel>

                    </StackPanel>
                </Border>
                
            </Grid>
            
        </Border>
        
    </Border>
</Window>
